package controller;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class helloWorld implements Controller {
    public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
        System.out.println("handleRequest被调用");
        ModelAndView mav = new ModelAndView();
        //将message对象添加的到ModelAndView中
        mav.addObject("message", "Hello Spring MVC");
        //设置要转发的页面
        mav.setViewName("helloWorld");
        return mav;
    }
}

